using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for EntityWanderer
/// </summary>
public class EntityWanderer:GameEntity
{
    public EntityWanderer(int id, string name, int x, int y, string eChar, int MapNum):base(id,name,x,y,eChar, MapNum, 1)
	{
		//
		// TODO: Add constructor logic here
		//

	}

    public EntityWanderer()
    {
        // Parameterless constructor to allow for serialization
    }

    public void wander(){
        // create some random wanderings
        int moveX = (int) GameWorld.rnd.Next(3) - 1;
        int moveY = (int) GameWorld.rnd.Next(3) - 1;
        // check if we can actually perform those movements
        try
        {
            if (GameWorld.getMap(0)[Y + moveY][X + moveX] != '#')
            {
                X += moveX;
                Y += moveY;
            }
        }
        catch
        {
            // TODO: I probably shouldn't rely on exceptions here to test for valid moves
        }

    }
}
